extends Control

var pos0:Vector2 = Vector2.ZERO # 原点
var pos2:Vector2

func _ready():
	pos2 = $Position1.position
	
	$Line1.set_point_position(0,pos0)
	$Line2.set_point_position(0,pos0)
	$Line2.set_point_position(1,pos2)
	
	var pos2_pos = Vector2(round(pos2.x),round(pos2.x))
	
	$Label2.text = "B:" + str(pos2_pos)
	$Label2.rect_position = pos2
	pass 



	
func _process(delta):
	var angle = get_global_mouse_position().angle_to_point(pos2)
	var angle2 = pos2.angle_to_point(get_global_mouse_position())
	$Label.text = "A.angle_to_point(B):" + str(rad2deg(angle))
	$Label.text += "\nB.angle_to_point(A):" + str(rad2deg(angle2))
	var pos = get_global_mouse_position()
	$Line1.set_point_position(1,pos)
	$Label1.text = "A:" + str(pos)
	$Label1.rect_position = pos 
	# 绘制两个向量之间的连线
	$Line3.set_point_position(0,pos2)
	$Line3.set_point_position(1,pos)
